﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DiamondDesktop.Presenters;

namespace DiamondDesktop.Presenters
{
    public delegate void notifyObserver(Object arg);
     public abstract class Observable
    {
        public event notifyObserver notifyObserverEvent;

        public void addObserver(notifyObserver ob)
        {
            notifyObserverEvent += ob;
        }

        public void deleteObserver(notifyObserver ob)
        {
            notifyObserverEvent -= ob;
        }

        protected void notifyObservers()
        {
            notifyObservers(null);
        }

        protected void notifyObservers(Object obj)
        {
            if (notifyObserverEvent != null)
            {
                notifyObserverEvent(obj);
            }
        }

    }
}
